package demo;

/**
 * Created with IntelliJ IDEA.
 * Description:内部类语法:定义在类内部的类
 * User: LianBao
 * Date: 2024-03-14
 * Time: 11:08
 */


import java.util.Scanner;

/**
 * 内部类:
 * 1.实例内部类
 * 2.静态内部类
 * 3.匿名内部类
 * 4.局部内部类
 * 内部类会单独生成一个字节码文件
 */


class OuterClass {

    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    public int name = 1999;

    /**
     * 实例内部类
     * 1.如何使用实例内部类?
     * 外部类.内部类 变量名字 = 外部类对象的引用.new 内部类
     * OuterClass out = new OuterClass();
     * OuterClass.InnerClass innerClass = out.new InnerClass();
     */

    class InnerClass {
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public int name = 0;


        public void Test() {
            OuterClass outerClass = new OuterClass();
            System.out.println("使用外部类的引用直接访问" + outerClass.name);
            System.out.println("InnerTestA()");
            System.out.println("==========");
            System.out.println(data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println("=========");
            System.out.println("重名的访问:");
            System.out.println("外部类类名.this.成员变量" + OuterClass.this.name);
            System.out.println(name);

        }
    }

    public void TestA() {
        System.out.println("OuterTestA()");
    }
}


class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        int count = 1;
        //write your code here......
        StringBuffer ss = new StringBuffer(str);
        for (int i = str.length() - 1; i >= 0; i--) {
            count++;
            if(count ==3&&i>0) {
                ss.insert(i-1,',');
                count=0;
            }
        }
        System.out.println(ss.toString());

    }
}
public class Test1 {
    public static void main(String[] args) {
        OuterClass out = new OuterClass();
        OuterClass.InnerClass innerClass = out.new InnerClass();
        innerClass.Test();
    }
}
